package top.anka1.fxgui;

import javafx.scene.control.*;
import javafx.scene.text.Font;
import top.anka1.ims.*;

import javafx.fxml.FXML;

public class AboutCopyrightController {
    private Boolean flag = true;
    private OSinfo osInfo = new OSinfo();
    @FXML
    private Label aboutTitleLabel;
    @FXML
    private Label copyrightFooterLabel;
    @FXML
    private Button openGiteeButton;
    @FXML
    private Button openHomepageButton;

    @FXML
    public void openGitee() {
        // Open the Gitee link in the default web browser
        String giteeUrl = "https://gitee.com/Anka-Victorique-de-Blois/end-of-semester-group-project";
        try {
            java.awt.Desktop.getDesktop().browse(java.net.URI.create(giteeUrl));
            openGiteeButton.setText("Thank you for your visit!");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @FXML
    public void openAnka1() {
        // Open the Anka1 link in the default web browser
        String anka1Url = "https://www.anka1.top/";
        try {
            java.awt.Desktop.getDesktop().browse(java.net.URI.create(anka1Url));
            openHomepageButton.setText("Thank you for visiting my homepage!");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @FXML
    public void showEasterEgg1() {
        if (flag) {
            aboutTitleLabel.setFont(new Font(18));
            aboutTitleLabel.setText("You found an Easter Egg! Here is a sentence of my favorite for you: \nBeautiful Word, Beautiful World.");
            flag = false;
        } else {
            aboutTitleLabel.setFont(new Font(36));
            aboutTitleLabel.setText("About");
            flag = true;
        }

    }
    @FXML
    public void showEasterEgg2() {
        if (osInfo.isWindows()) {
            copyrightFooterLabel.setFont(new Font("Microsoft YaHei", 12));
        } else if (osInfo.isLinux()) {
            copyrightFooterLabel.setFont(new Font("Noto Sans SC", 12));
        } else if (osInfo.isMacOS() | osInfo.isMacOSX()) {
            copyrightFooterLabel.setFont(new Font("PingFang SC Medium", 12));
        }
        copyrightFooterLabel.setText("无刺藏锋藏深意，有刺反骨反万尘！");
    }
    @FXML
    public void resetFooter() {
        copyrightFooterLabel.setFont(new Font("System", 12));
        copyrightFooterLabel.setText("Copyright © 2025 Anka All rights reserved.");
    }
}
